@echo off
setlocal enabledelayedexpansion 
rem cd F:\_jenkins\tomcat-8.5.6-9527\bin
rem F:
rem startup.bat

rem ============================= 这里需要注意几个细节:
rem 1. 以下定义的数组的最大索引号需要同步更新到 for 迭代语句中
rem 2. 最好将tomcat放在同一个根目录下
rem 3. for循环中要切换
set LOCATION[0]=D:\tomcats\apache-tomcat-7.0.51
set LOCATION[1]=D:\tomcats\apache-tomcat-7.0.52
set LOCATION[2]=D:\tomcats\apache-tomcat-7.0.53
set LOCATION[3]=D:\tomcats\apache-tomcat-7.0.54

for /l %%n in (0,1,3) do ( 
   echo !LOCATION[%%n]!\bin\
   cd !LOCATION[%%n]!\bin\
   D:\
   cmd /c "startup.bat"
)

rem set LOCATIONS=D:\tomcats\apache-tomcat-7.0.51 D:\tomcats\apache-tomcat-7.0.52 D:\tomcats\apache-tomcat-7.0.53 D:\tomcats\apache-tomcat-7.0.54
rem (for %%a in (%LOCATIONS%) do ( 
rem 	echo %%a\bin\
rem 	cd %%a\bin\
rem 	rem startup.bat
rem ))

pause